/* Enter your code here. Read input from STDIN. Print output to STDOUT */
import java.io.IOException;
import java.util.HashSet;
import java.util.NoSuchElementException;
import java.util.Scanner;
import java.util.Set;
import java.util.StringTokenizer;

public class Solution {

	private static String[] permutation(String orginal) {
		Set<String> set = new HashSet<String>();
		String[] str = new String[1];

		if (orginal.length() == 1) {
			str[0] = orginal;
			return str;
		} else {
			for (int i = 0; i < orginal.length(); i++) {
				String s = orginal.charAt(i) + "";
				String result = "";
				String resultA = result + s;
				String leftS = orginal.substring(0, i)
						+ orginal.substring(i + 1, orginal.length());
				for (String element : permutation(leftS)) {
					result = resultA + element;
					set.add(result);
				}
			}
			return (String[]) set.toArray(new String[set.size()]);
		}
	}

	private static boolean move(String str, int[][] a, int[][] b) {
		int k, j = 0;
		int temp = 0;
		for (k = 0; k < 5; k++) {
			for (j = 0; j < 5; j++) {

				if (a[k][j] == 0) {
					break;
				}
				break;
			}
		}

		for (int i = 0; i < str.length(); i++) {
			switch (str.charAt(i)) {
			case 'R':
				if (j == 4) {
					continue;
				} else {
					temp = a[k][j + 1];
					a[k][j + 1] = a[k][j];
					a[k][j] = temp;
					j++;
				}
			case 'L':
				if (j == 0) {
					continue;
				} else {
					temp = a[k][j - 1];
					a[k][j - 1] = a[k][j];
					a[k][j] = temp;
					j--;
				}
			case 'U':
				if (k == 0) {
					continue;
				} else {
					temp = a[k - 1][j];
					a[k - 1][j] = a[k][j];
					a[k][j] = temp;
					k--;
				}
			case 'D':
				if (k == 4) {
					continue;
				} else {
					temp = a[k + 1][j];
					a[k + 1][j] = a[k][j];
					a[k][j] = temp;
					k++;
				}

			}

		}

		if (a.equals(b)) {
			return true;
		} else {
			return false;
		}
	}

	// Your code is here.
	// Return a correctSequence if has, otherwise return "None";
	public String calculateTheRightSequence(int[][] originalMatrix,
			int[][] targetMatrix, String inputSequence) {

		String[] strArr = permutation(inputSequence);
		for (int i = 0; i < strArr.length; i++) {
			if (move(strArr[i], originalMatrix, targetMatrix)) {
				return strArr[i];
			}
		}

		return "NONE";
	}

	public static void main(String[] args) throws IOException {
		int matrixSize = 5;
		int[][] originalMatrix = new int[matrixSize][matrixSize];
		int[][] targetMatrix = new int[matrixSize][matrixSize];
		String inputSequenceString;
		Solution solution = new Solution();
		InputHelper inputHelper = solution.new InputHelper();

		Scanner scanner = new Scanner(System.in);
		while (scanner.hasNextLine()) {
			// Get information from STDIN.
			String params = scanner.nextLine();
			StringTokenizer stringTokenizer = new StringTokenizer(params);

			try {
				// Initialize the original matrix.
				for (int i = 0; i < matrixSize; i++) {
					for (int j = 0; j < matrixSize; j++) {
						originalMatrix[i][j] = inputHelper
								.getNextIntFromInput(stringTokenizer);
					}
				}

				// Initialize the target matrix.
				for (int i = 0; i < matrixSize; i++) {
					for (int j = 0; j < matrixSize; j++) {
						targetMatrix[i][j] = inputHelper
								.getNextIntFromInput(stringTokenizer);
					}
				}

				// Initialize input sequence.
				inputSequenceString = inputHelper
						.getInputSequenceFromInput(stringTokenizer);

				// Calculate the correct sequence.
				String calculatedSequence = solution.calculateTheRightSequence(
						originalMatrix, targetMatrix, inputSequenceString);
				System.out.println(calculatedSequence);
			} catch (InvalidInputException invalidInputException) {
				System.out.println(invalidInputException.getMessage());
				return;
			}
		}
	}

	// Internal class
	public class InputHelper {
		public int getNextIntFromInput(StringTokenizer stringTokenizer)
				throws InvalidInputException {
			String inputString = "";
			try {
				inputString = stringTokenizer.nextToken();
				return Integer.parseInt(inputString);
			} catch (NumberFormatException numberFormatException) {
				throw new InvalidInputException(
						"Invalid input, cannot get int value from the input: "
								+ inputString, numberFormatException);
			} catch (NoSuchElementException noSuchElementException) {
				throw new InvalidInputException(
						"Invalid input, cannot get the next int value from the input.",
						noSuchElementException);
			}

		}

		public String getInputSequenceFromInput(StringTokenizer stringTokenizer)
				throws InvalidInputException {
			try {
				return stringTokenizer.nextToken();
			} catch (NoSuchElementException noSuchElementException) {
				throw new InvalidInputException(
						"Invalid input, cannot get the input sequence from the input.",
						noSuchElementException);
			}
		}
	}

	public class InvalidInputException extends Exception {
		private static final long serialVersionUID = 1L;

		public InvalidInputException() {
		}

		public InvalidInputException(String arg0, Throwable arg1) {
			super(arg0, arg1);
		}
	}
}
